Translating Questions to SQL Queries with Generative Parsers Discriminatively Reranked
نویسندگان
چکیده
In this paper, we define models for automatically translating a factoid question in natural language to an SQL query that retrieves the correct answer from a target relational database (DB). We exploit the DB structure to generate a set of candidate SQL queries, which we rerank with an SVM-ranker based on tree kernels. In particular, in the generation phase, we use (i) lexical dependencies in the question and (ii) the DB metadata, to build a set of plausible SELECT, WHERE and FROM clauses enriched with meaningful joins. We combine the clauses by means of rules and a heuristic weighting scheme, which allows for generating a ranked list of candidate SQL queries. This approach can be recursively applied to deal with complex questions, requiring nested SELECT instructions. Finally, we apply the reranker to reorder the list of question and SQL candidate pairs, whose members are represented as syntactic trees. The F1 of our model derived on standard benchmarks, 87% on the first question, is in line with the best models using external and expensive hand-crafted resources such as the question meaning interpretation. Moreover, our system shows a Recall of the correct answer of about 94% and 98% on the first 2 and 5 candidates, respectively. This is an interesting outcome considering that we only need pairs of questions and answers concerning a target DB (no SQL query is needed) to train our model.
منابع مشابه
Structural Mapping between Natural Language Questions and SQL Queries
A core problem in data mining is to retrieve data in an easy and human friendly way. Automatically translating natural language questions into SQL queries would allow for the design of effective and useful database systems from a user viewpoint. In this thesis, we approach such problem by carrying out a mapping between natural language (NL) and SQL syntactic structures. The mapping is automatic...
متن کاملSyntactic Structural Kernels for Natural Language Interfaces to Databases
A core problem in data mining is to retrieve data in a easy and human friendly way. Automatically translating natural language questions into SQL queries would allow for the design of effective and useful database systems from a user viewpoint. Interesting previous work has been focused on the use of machine learning algorithms for automatically mapping natural language (NL) questions to SQL qu...
متن کاملEfficient XML - to - SQL Query Translation : Where to Add the Intelligence ? ( Extended
Exporting XML views of relational data gives rise to the problem of translating XML queries into SQL. To date, the focus of most of the work in the published literature [9, 14, 20] has been on mechanisms for correctly translating complex XML queries into SQL queries, with less emphasis on evaluating the quality of the resulting SQL queries. The efficiency of the SQL queries generated by the tra...
متن کاملGenerating SQL Queries Using Natural Language Syntactic Dependencies and Metadata
This research concerns with translating natural language questions into SQL queries by exploiting the MySQL framework for both hypothesis construction and thesis verification in the task of question answering. We use linguistic dependencies and metadata to build sets of possible SELECT and WHERE clauses. Then we exploit again the metadata to build FROM clauses enriched with meaningful joins. Fi...
متن کاملSeq2sql: Generating Structured Queries
Relational databases store a significant amount of the world’s knowledge. However, users are limited in their ability to access this knowledge due to a lack of understanding of query languages such as SQL. We propose Seq2SQL, a deep neural network for translating natural language questions to corresponding SQL queries. Our model leverages the structure of SQL queries to reduce the output space ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2012